package com.cn.yugan.Engine.Json;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Rover on 2016/10/11 .
 * Email 357319517@qq.com
 */
public class ArticleJson {
    private JSONObject json;
    private JSONObject article;
    private boolean success;

    public ArticleJson(String json) {
        try {
            this.json = new JSONObject(json);
            init();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    private void init() {
        try {
            success = json.getBoolean("success");
            article = json.getJSONObject("data");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public String gettitle() {
        try {
            return article.getString("title");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getauthor() {
        try {
            return article.getString("author");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getcontent() {
        try {
            return article.getString("content");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getintro() {
        try {
            return article.getString("intro");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String gettags() {
        try {
            return article.getString("tags");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String gettime() {
        try {
            return article.getString("time");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getuid() {
        try {
            return article.getString("uid");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getsource() {
        try {
            return article.getString("source");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getuserface() {
        try {
            return article.getString("userface");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getuintro() {
        try {
            return article.getString("uintro");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }

    public String getucount() {
        try {
            return article.getString("ucount");
        } catch (JSONException e) {
            e.printStackTrace();
            return "";
        }

    }
}
